#!/usr/bin/env python
# encoding: utf-8
from feature_conf.loan import LoanConfigConstant
from utils import extract_order_features


class LoanIdOrderV1():

    @staticmethod
    def get_features(data):
        df = data['order_df']
        order_day_features_dict = {}
        for day in LoanConfigConstant.ORDER_DAYS_LIST:
            day_feature = extract_order_features(df, time_col='date_inter', time_inter=day, version='v1', country_id='id')
            order_day_features_dict.update(day_feature)

        order_rank_features_dict = {}
        for rk in LoanConfigConstant.ORDER_RANKS_LIST:
            rank_feature = extract_order_features(df, time_col='loan_rank', time_inter=rk, version='v1', country_id='id')
            order_rank_features_dict.update(rank_feature)

        order_month_features_dict = {}
        for mth in LoanConfigConstant.ORDER_MTH_LIST:
            month_feature = extract_order_features(df, time_col='mth_inter', time_inter=mth, version='v1', country_id='id')
            order_month_features_dict.update(month_feature)

        return order_day_features_dict | order_rank_features_dict | order_month_features_dict
